//暴力枚举
class Solution {
public:
    int hIndex(vector<int>& citations) {
        int h=0,n=citations.size();
        for(int i=1;i<=n;i++)
        {
            int ret=0;
            for(int j=0;j<n;j++)
            {
                if(citations[j]>=i)
                 ret++;
            }
            if(ret>h)
            h=i;
        }
        return h;
    }
};
//排序
class Solution {
public:
    int hIndex(vector<int>& citations) {
        sort(citations.begin(),citations.end(),greater<int>());
        int i=0,h=0;
        while(i<=citations.size()-1&&citations[i]>h)
        {
            h++;
            i++;
        }
        return h;
    }
};